<?php
class Chart extends Action{
	public function setTitle($title){
		$this->title = $title;
		return $this;
	}
	public function setSubTitle($subtitle){
		$this->subtitle = $subtitle;
		return $this;
	}
	public function setDataSource(DataModel $dataModel){
		$this->dataModel = $dataModel;
		return $this;
	}
	public function setLabel($label){
		$this->label = $label;
		return $this;
	}
	public function getChart(){
		$this->elementId = 'chart' . uniqid();
		$dataModel = $this->dataModel;
		$dataModel->getData();
		$this->xcategories = $dataModel->getXcategories();
		$this->yseries = $dataModel->getYseries();
		return $this->fetch('Widget:chart');
	}
}